package com.codi.fundData.dao.impl;

import com.codi.base.dao.BaseDAOImpl;
import com.codi.base.dao.plugin.page.PageView;
import com.codi.fundData.dao.FundNetValueCasheDao;
import com.codi.fundData.domain.FundNetValueCashe;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("fundNetValueCasheDao")
public class FundNetValueCasheDaoImpl extends BaseDAOImpl<FundNetValueCashe> implements FundNetValueCasheDao{

    @Override
    public Page<Map<String, Object>> queryPages(Pageable pageable, Integer innerCode) {
        PageView pageView = this.getPageView(pageable.getPageNumber(), pageable.getPageSize());
        Map<String, Object> map = new HashMap<>();
        map.put("pageView", pageView);
        map.put("innerCode", innerCode);

        List<Map<String, Object>> cashes = getSqlSession().selectList(generateStatement("queryPages"), map);

        return new PageImpl<Map<String, Object>>(cashes, pageable, pageView.getRowCount());
    }
}
